import time
import datetime

def currentTimeMillis() ->int:
    '''当前毫秒时间戳'''
    return int(round(time.time()*1000))

def now() -> datetime.datetime:
    return datetime.datetime.now()

def formatDatetime(d:datetime.datetime,fmt="%Y-%m-%d %H:%M:%S") -> str:
    return d.strftime(fmt)

def formatDate(d:datetime.date,fmt="%Y-%m-%d") -> str:
    return d.strftime(fmt)

def formatTime(d:datetime.time,fmt="%H:%M:%S") -> str:
    return d.strftime(fmt)

def parseDatetime(s:str,fmt="%Y-%m-%d %H:%M:%S") -> datetime.datetime:
    return datetime.datetime.strptime(s, fmt)

def parseDate(s:str,fmt="%Y-%m-%d") -> datetime.datetime:
    return datetime.datetime.strptime(s, fmt)

def parseTime(s:str,fmt="%H:%M:%S") -> datetime.datetime:
    return datetime.datetime.strptime(s, fmt)

